package com.chaos.system.api.enums;

import com.chaos.framework.model.helper.EnumHelper;
import lombok.AllArgsConstructor;
import lombok.Getter;

public class OrderEnums {

    @Getter
    @AllArgsConstructor
    public enum OrderEnvironmentEnum {

        LAN("lan", "LAN-"),
        LOCAL("local", "LOCAL-"),
        DEV("dev", "DEV-"),
        TEST("test", "TEST-"),
        UAT("uat", "UAT-"),
        PROD("prod", "PROD"),

        ;
        private final String name;
        private final String prefix;

        public static OrderEnvironmentEnum getEnvironmentType(String envName) {
            for (OrderEnvironmentEnum type : values()) {
                if (type.name.equalsIgnoreCase(envName)) {
                    return type;
                }
            }
            return null;
        }
    }


    @Getter
    @AllArgsConstructor
    public enum OrderStatusEnum implements EnumHelper.EnumType {

        // 订单状态 1: 待支付 2:已支付
        INIT(0, "初始状态"),
        TO_BE_PAID(1, "待支付"),
        PAID(2, "已支付"),
        DONE(3, "已完成"),
        UNUSUAL_ORDER(8, "异常订单"),
        REFUNDED(9, "已退款"),
        CLOSED(10, "已关闭"),
        ;
        private int value;
        private String name;
    }

    @Getter
    @AllArgsConstructor
    public enum OrderPayStatusEnum implements EnumHelper.EnumType {

        // 订单状态 1: 未支付 2:已支付
        TO_BE_PAID(1, "待支付"),
        PAID(2, "已支付"),
        ;
        private int value;
        private String name;
    }

    @Getter
    @AllArgsConstructor
    public enum OrderPayTypeEnum implements EnumHelper.EnumType {

        // 支付方式（ 1:支付宝 2:微信 3:余额 ）
        ALI_PAY(1, "支付宝"),
        WECHAT_PAY(2, "微信"),
        BALANCE_PAY(3, "余额"),
        ;
        private int value;
        private String name;
    }


    @Getter
    @AllArgsConstructor
    public enum OrderPayTradeTypeEnum implements EnumHelper.EnumType {

        // 支付场景（0:余额支付 1:扫码支付 2:app支付 3:H5支付 4:公众号支付 5:小程序支付 6:信用分）


        Balance_TRADE_TYPE(0, "余额支付"),

        PC_PAY_TRADE_TYPE(1, "PC支付"),

        APP_PAY_TRADE_TYPE(2, "APP支付"),

        H5_PAY_TRADE_TYPE(3, "H5支付"),

        WXGZH_PAY_TRADE_TYPE(4, "公众号支付"),

        WXMINIPROGRAM_PAY_TRADE_TYPE(5, "小程序支付"),

        CREDIT_TRADE_TYPE(6, "信用支付"),
        ;
        private int value;
        private String name;


        public static boolean isCreditPayment(int value) {
            return CREDIT_TRADE_TYPE.value == value;
        }
    }


}
